<template>
  <div class="dashboard-editor-container">
    <h1>自定义数据分析</h1>
    <div style="margin-top: 20px">
      <el-input style="width: 100px;" disabled="boolean" value="查询对象:" class="filter-item"/>
      <el-checkbox v-model="checked101" label="商户对象" border size="medium"/>
      <el-checkbox v-model="checked102" label="商品对象" border size="medium"/>
      <el-checkbox v-model="checked103" label="订单对象" border size="medium"/>
    </div>
    <div style="margin-top: 20px">
      <el-input style="width: 100px;" disabled="boolean" value="条件字段:" class="filter-item"/>
      <el-checkbox v-model="checked201" label="商户类字段" border size="medium"/>
      <el-checkbox v-model="checked202" label="商品类字段" border size="medium"/>
      <el-checkbox v-model="checked203" label="订单类字段" border size="medium"/>
    </div>
    <div style="margin-top: 20px">
      <el-input style="width: 100px;" disabled="boolean" value="排序字段:" class="filter-item"/>
      <el-checkbox v-model="checked301" label="商户类字段" border size="medium"/>
      <el-checkbox v-model="checked302" label="商品类字段" border size="medium"/>
      <el-checkbox v-model="checked303" label="订单类字段" border size="medium"/>
    </div>
    <div style="margin-top: 20px">
      <el-input style="width: 100px;" disabled="boolean" value="查询方法:" class="filter-item"/>
      <el-checkbox v-model="checked401" label="显示明细记录" border size="medium"/>
      <el-checkbox v-model="checked402" label="显示汇总数据" border size="medium"/>
      <el-checkbox v-model="checked403" label="显示分组汇总数据" border size="medium"/>
    </div>
    <div style="margin-top: 20px">
      <el-input style="width: 100px;" disabled="boolean" value="结果字段:" class="filter-item"/>
      <el-checkbox v-model="checked501" label="商户类字段" border size="medium"/>
      <el-checkbox v-model="checked502" label="商品类字段" border size="medium"/>
      <el-checkbox v-model="checked503" label="订单类字段" border size="medium"/>
    </div>
    <div style="margin-top: 20px">
      <el-input style="width: 100px;" disabled="boolean" value="结果内容:" class="filter-item"/>
      <el-checkbox v-model="checked601" label="显示表格列表数据" border size="medium"/>
      <el-checkbox v-model="checked602" label="显示磁贴照片数据" border size="medium"/>
      <el-button v-waves size="medium" class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">生成分析报告</el-button>
      <el-button v-waves :loading="downloadLoading" size="medium" class="filter-item" type="success" icon="el-icon-download" @click="handleDownload">导出WORD文件</el-button>
    </div>

    <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
      <line-chart :chart-data="lineChartData"/>
    </el-row>

    <el-row :gutter="32">
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="chart-wrapper">
          <raddar-chart/>
        </div>
      </el-col>
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="chart-wrapper">
          <pie-chart/>
        </div>
      </el-col>
      <el-col :xs="24" :sm="24" :lg="8">
        <div class="chart-wrapper">
          <bar-chart/>
        </div>
      </el-col>
    </el-row>

  </div>
</template>

<script>
import PanelGroup from './components/PanelGroup'
import LineChart from './components/LineChart'
import RaddarChart from './components/RaddarChart'
import PieChart from './components/PieChart'
import BarChart from './components/BarChart'
import TransactionTable from './components/TransactionTable'
import TodoList from './components/TodoList'

const lineChartData = {
  newVisitis: {
    expectedData: [100, 120, 161, 134, 105, 160, 165, 165, 200, 220, 211, 174],
    actualData: [120, 82, 91, 154, 162, 140, 145, 145, 168, 182, 191, 154]
  },
  messages: {
    expectedData: [200, 192, 120, 144, 160, 130, 140],
    actualData: [180, 160, 151, 106, 145, 150, 130]
  },
  purchases: {
    expectedData: [80, 100, 121, 104, 105, 90, 100],
    actualData: [120, 90, 100, 138, 142, 130, 130]
  },
  shoppings: {
    expectedData: [130, 140, 141, 142, 145, 150, 160],
    actualData: [120, 82, 91, 154, 162, 140, 130]
  }
}

export default {
  name: 'DashboardAdmin',
  components: {
    PanelGroup,
    LineChart,
    RaddarChart,
    PieChart,
    BarChart,
    TransactionTable,
    TodoList
  },
  data() {
    return {
      lineChartData: lineChartData.newVisitis
    }
  },
  methods: {
    handleSetLineChartData(type) {
      this.lineChartData = lineChartData[type]
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}
</style>
